import 'package:favorcate/core/viewmodel/favor_view_mode.dart';
import 'package:favorcate/ui/widgets/meal_item.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ZSFavorContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<ZSFavorViewModel>(builder: (ctx, favorVM, child) {
      if (favorVM.meals.length == 0) {
        return Center(
            child: Text('未收藏美食')
        );
      }
      return ListView.builder(
          itemCount: favorVM.meals.length,
          itemBuilder: (itemCtx, index) {
            return ZSMealItem(favorVM.meals[index]);
          });
    });
  }
}
